<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <link rel="StyleSheet" href="../css/itemcard.css" type="text/css"
          media="screen"/>
</head>
<body>
    <div th:replace="common/top"></div>

    <div id="Catalog">
        <h2 th:text="${session.product.name}">${sessionScope.product.name}</h2>
        <div class="item_card_groups">
            <div class="item_card_group">
                <!--c:forEach-- var="item" items="${sessionScope.itemList}">
                    <div id="item">
                        <div class="item_card">
                            <div class="item_card_pic">
                                <div>
                                    <img id="pic" src="${sessionScope.product.description}"/>
                                </div>
                            </div>
                            <div class="item_card_content">
                                <div>
                                    <h4><a href="itemForm?itemId=${item.itemId}">${item.itemId}</a></h4>
                                </div>
                                <div class="item_card_description">
                                    <div>
                                        ${item.product.productId}
                                        <div>
                                            ${item.attribute1}
                                        </div>
                                        <div>
                                            ${item.attribute2}
                                        </div>
                                        ${item.attribute3}
                                        <div>
                                            ${item.attribute4}
                                        </div>
                                        ${item.attribute5}
                                    </div>
                                    <div>
                                        ${sessionScope.product.name}</div>
                                    <div>
                                        <fmt:formatNumber value="${item.listPrice}" pattern="$#,##0.00"/>
                                    </div>
                                    <br>
                                    <br>
                                    <div>
                                        <flag session和request的定义是避免刷新自增用的 -->
                                        <!--%session.setAttribute("flag", 1);%>
                                        <a href="addItemToCart?workingItemId=${item.itemId}&flag=1" class="Button">加入购物车</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </c:forEach-->



                <!--c:forEach var="item" items="${sessionScope.itemList}"-->
                    <div id="item" th:each="item:${session.itemList}">
                        <div class="item_card">
                            <div class="item_card_pic">
                                <div>
                                    <img id="pic" th:src="${session.product.description}"/>
                                </div>
                            </div>
                            <div class="item_card_content">
                                <div>
                                    <h4><a th:href="@{itemForm(itemId=${item.itemId})}" th:text="${item.itemId}">${item.itemId}</a></h4>
                                </div>
                                <div class="item_card_description">
                                    <div th:text="${item.product.productId}" >
                                        ${item.product.productId}
                                    </div>

                                    <div  th:text="${item.attribute1}">
                                            ${item.attribute1}
                                    </div>

                                    <div th:text="${item.attribute2}">
                                            ${item.attribute2}qqqqqqqqqqq
                                    </div>

                                    <div th:text="${item.attribute3}">

                                    </div>

                                    <div th:text="${item.attribute4}">
                                            ${item.attribute4}
                                    </div>


                                    <div th:text="${item.attribute5}">
                                            ${item.attribute5}
                                    </div>

                                </div>
                                    <div th:text="${session.product.name}">
                                        ${sessionScope.product.name}
                                    </div>
                                    <div th:text="'$'+${item.listPrice}">
                                        <!--fmt:formatNumber value="${item.listPrice}" pattern="$#,##0.00"/-->
                                    </div>
                                    <br>
                                    <br>

                                    <div>
                                        <!--flag session和request的定义是避免刷新自增用的 -->
                                        <!--%session.setAttribute("flag", 1);%-->
                                        <a th:href="@{/addItemToCart(workingItemId=${item.itemId})}" class="Button">加入购物车</a>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                <!--/c:forEach-->

            </div>
        </div>
    </div>


</body>
</html>